From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 11:13:25 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0001.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 15:13:57 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0002.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 15:21:20 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0003.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 16:00:53 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Jan 13 20:01:49 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 20:01:49 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Jan 13 20:01:49 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Jan 13 20:01:49 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 20:01:49 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Jan 13 20:01:49 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 20:01:49 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Jan 13 20:01:50 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 13 20:01:50 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 20:01:50 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 13 20:01:50 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Jan 13 20:01:50 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 20:01:50 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Jan 13 20:01:50 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Jan 13 20:01:50 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0004.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 20:01:50 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 20:01:50 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Jan 13 20:01:50 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 20:01:50 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Jan 13 20:01:50 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 13 20:01:50 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0005.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 08:02:26 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sat Jan 14 12:00:51 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 12:00:52 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sat Jan 14 12:00:52 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sat Jan 14 12:00:52 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 12:00:52 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sat Jan 14 12:00:52 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 12:00:52 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sat Jan 14 12:00:52 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 14 12:00:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 12:00:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 14 12:00:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sat Jan 14 12:00:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 12:00:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sat Jan 14 12:00:52 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sat Jan 14 12:00:52 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0006.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 12:00:52 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 12:00:52 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sat Jan 14 12:00:52 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 12:00:52 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sat Jan 14 12:00:52 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 12:00:52 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0007.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 16:00:49 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0008.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 14 20:00:48 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sun Jan 15 08:02:14 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 08:02:14 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sun Jan 15 08:02:14 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sun Jan 15 08:02:14 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 08:02:14 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sun Jan 15 08:02:14 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 08:02:15 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sun Jan 15 08:02:15 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 15 08:02:15 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 08:02:15 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 15 08:02:15 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sun Jan 15 08:02:15 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 08:02:15 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sun Jan 15 08:02:15 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sun Jan 15 08:02:15 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0009.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 08:02:15 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 08:02:15 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sun Jan 15 08:02:15 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 08:02:15 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sun Jan 15 08:02:15 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 08:02:15 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sun Jan 15 12:00:56 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 12:00:56 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sun Jan 15 12:00:56 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sun Jan 15 12:00:56 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 12:00:56 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sun Jan 15 12:00:56 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 12:00:56 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sun Jan 15 12:00:56 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 15 12:00:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 12:00:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 15 12:00:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sun Jan 15 12:00:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 12:00:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sun Jan 15 12:00:56 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sun Jan 15 12:00:56 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0010.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 12:00:57 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 12:00:57 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sun Jan 15 12:00:57 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 12:00:57 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sun Jan 15 12:00:57 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 12:00:57 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sun Jan 15 16:00:48 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 16:00:48 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sun Jan 15 16:00:48 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sun Jan 15 16:00:49 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 16:00:49 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sun Jan 15 16:00:49 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 16:00:49 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sun Jan 15 16:00:49 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 15 16:00:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 16:00:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 15 16:00:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sun Jan 15 16:00:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 16:00:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sun Jan 15 16:00:49 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sun Jan 15 16:00:49 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0011.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 16:00:49 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 16:00:49 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sun Jan 15 16:00:49 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 16:00:49 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sun Jan 15 16:00:49 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 16:00:49 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0012.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 15 20:00:48 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0013.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 08:02:38 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0014.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 12:00:53 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Mon Jan 16 16:00:52 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 16:00:52 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Mon Jan 16 16:00:52 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Mon Jan 16 16:00:52 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 16:00:52 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Mon Jan 16 16:00:52 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 16:00:52 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Mon Jan 16 16:00:52 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 16 16:00:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 16:00:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 16 16:00:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Mon Jan 16 16:00:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 16:00:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Mon Jan 16 16:00:53 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Mon Jan 16 16:00:53 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0015.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 16:00:53 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 16:00:53 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Mon Jan 16 16:00:53 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 16:00:53 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Mon Jan 16 16:00:53 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 16:00:53 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Mon Jan 16 20:00:48 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 20:00:48 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Mon Jan 16 20:00:48 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Mon Jan 16 20:00:48 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 20:00:48 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Mon Jan 16 20:00:48 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 20:00:48 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Mon Jan 16 20:00:48 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 16 20:00:48 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 20:00:48 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 16 20:00:48 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Mon Jan 16 20:00:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 20:00:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Mon Jan 16 20:00:49 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Mon Jan 16 20:00:49 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0016.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 20:00:49 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 20:00:49 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Mon Jan 16 20:00:49 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 20:00:49 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Mon Jan 16 20:00:49 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 16 20:00:49 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0017.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 08:02:41 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0018.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 12:01:09 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0019.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 16:00:55 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0020.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 17 20:00:56 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Jan 18 08:04:24 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 08:04:24 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Jan 18 08:04:24 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Jan 18 08:04:24 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 08:04:24 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Jan 18 08:04:24 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 08:04:24 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Jan 18 08:04:24 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Jan 18 08:04:24 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 08:04:24 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Jan 18 08:04:24 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Jan 18 08:04:24 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 08:04:24 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Jan 18 08:04:24 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Jan 18 08:04:25 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0021.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 08:04:25 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 08:04:25 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Jan 18 08:04:25 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 08:04:25 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Jan 18 08:04:25 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 08:04:25 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Jan 18 12:01:10 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 12:01:10 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Jan 18 12:01:10 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Jan 18 12:01:10 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 12:01:10 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Jan 18 12:01:10 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 12:01:10 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Jan 18 12:01:10 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Jan 18 12:01:10 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 12:01:10 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Jan 18 12:01:10 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Jan 18 12:01:10 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 12:01:10 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Jan 18 12:01:10 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Jan 18 12:01:10 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0022.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 12:01:10 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 12:01:11 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Jan 18 12:01:11 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 12:01:11 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Jan 18 12:01:11 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 12:01:11 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Jan 18 16:01:37 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 16:01:37 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Jan 18 16:01:37 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Jan 18 16:01:37 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 16:01:37 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Jan 18 16:01:37 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 16:01:37 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Jan 18 16:01:37 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Jan 18 16:01:37 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 16:01:37 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Jan 18 16:01:38 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Jan 18 16:01:38 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 16:01:38 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Jan 18 16:01:38 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Jan 18 16:01:38 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0023.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 16:01:38 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 16:01:38 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Jan 18 16:01:38 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 16:01:38 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Jan 18 16:01:38 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 16:01:38 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0024.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 18 20:01:00 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Thu Jan 19 08:04:47 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 08:04:47 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Thu Jan 19 08:04:47 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Thu Jan 19 08:04:47 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 08:04:47 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Thu Jan 19 08:04:47 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 08:04:47 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Thu Jan 19 08:04:48 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Jan 19 08:04:48 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 08:04:48 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Jan 19 08:04:48 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Thu Jan 19 08:04:48 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 08:04:48 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Thu Jan 19 08:04:48 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Thu Jan 19 08:04:48 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0025.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 08:04:48 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 08:04:48 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Thu Jan 19 08:04:48 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 08:04:48 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Thu Jan 19 08:04:48 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 08:04:48 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0026.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 12:01:05 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Thu Jan 19 16:03:19 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 16:03:19 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Thu Jan 19 16:03:19 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Thu Jan 19 16:03:19 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 16:03:19 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Thu Jan 19 16:03:19 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 16:03:20 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Thu Jan 19 16:03:20 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Jan 19 16:03:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 16:03:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Jan 19 16:03:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Thu Jan 19 16:03:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 16:03:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Thu Jan 19 16:03:20 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Thu Jan 19 16:03:20 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0027.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 16:03:21 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 16:03:21 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Thu Jan 19 16:03:21 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 16:03:21 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Thu Jan 19 16:03:21 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 16:03:21 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0028.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 19 20:00:53 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Jan 20 08:07:34 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 08:07:35 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Jan 20 08:07:35 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Jan 20 08:07:35 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 08:07:35 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Jan 20 08:07:35 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 08:07:35 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Jan 20 08:07:35 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 20 08:07:35 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 08:07:35 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 20 08:07:35 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Jan 20 08:07:35 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 08:07:36 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Jan 20 08:07:36 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Jan 20 08:07:36 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0029.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 08:07:36 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 08:07:36 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Jan 20 08:07:36 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 08:07:36 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Jan 20 08:07:36 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 08:07:36 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Jan 20 12:02:15 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 12:02:15 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Jan 20 12:02:16 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Jan 20 12:02:16 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 12:02:16 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Jan 20 12:02:16 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 12:02:16 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Jan 20 12:02:16 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 20 12:02:16 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 12:02:16 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 20 12:02:16 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Jan 20 12:02:16 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 12:02:16 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Jan 20 12:02:16 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Jan 20 12:02:16 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0030.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 12:02:16 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 12:02:16 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Jan 20 12:02:16 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 12:02:16 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Jan 20 12:02:17 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 12:02:17 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Jan 20 16:00:57 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 16:00:57 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Jan 20 16:00:57 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Jan 20 16:00:57 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 16:00:57 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Jan 20 16:00:57 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 16:00:57 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Jan 20 16:00:57 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 20 16:00:58 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 16:00:58 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 20 16:00:58 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Jan 20 16:00:58 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 16:00:58 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Jan 20 16:00:58 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Jan 20 16:00:58 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0031.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 16:00:58 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 16:00:58 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Jan 20 16:00:58 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 16:00:58 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Jan 20 16:00:58 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 16:00:58 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Jan 20 20:00:52 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 20:00:52 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Jan 20 20:00:52 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Jan 20 20:00:52 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 20:00:52 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Jan 20 20:00:52 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 20:00:52 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Jan 20 20:00:52 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 20 20:00:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 20:00:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 20 20:00:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Jan 20 20:00:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 20:00:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Jan 20 20:00:52 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Jan 20 20:00:53 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0032.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 20:00:53 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 20:00:53 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Jan 20 20:00:53 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 20:00:53 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Jan 20 20:00:53 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 20 20:00:53 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0033.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 08:04:04 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sat Jan 21 12:01:06 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 12:01:06 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sat Jan 21 12:01:06 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sat Jan 21 12:01:06 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 12:01:06 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sat Jan 21 12:01:07 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 12:01:07 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sat Jan 21 12:01:07 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 21 12:01:07 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 12:01:07 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 21 12:01:07 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sat Jan 21 12:01:07 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 12:01:07 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sat Jan 21 12:01:07 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sat Jan 21 12:01:07 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0034.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 12:01:07 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 12:01:07 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sat Jan 21 12:01:07 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 12:01:07 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sat Jan 21 12:01:07 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 12:01:07 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0035.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 16:00:56 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sat Jan 21 20:00:54 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 20:00:54 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sat Jan 21 20:00:54 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sat Jan 21 20:00:54 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 20:00:54 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sat Jan 21 20:00:54 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 20:00:54 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sat Jan 21 20:00:55 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 21 20:00:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 20:00:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 21 20:00:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sat Jan 21 20:00:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 20:00:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sat Jan 21 20:00:55 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sat Jan 21 20:00:55 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0036.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 20:00:55 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 20:00:55 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sat Jan 21 20:00:55 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 20:00:55 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sat Jan 21 20:00:55 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 21 20:00:55 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sun Jan 22 08:02:55 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 08:02:55 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sun Jan 22 08:02:55 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sun Jan 22 08:02:55 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 08:02:55 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sun Jan 22 08:02:55 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 08:02:55 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sun Jan 22 08:02:55 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 22 08:02:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 08:02:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 22 08:02:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sun Jan 22 08:02:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 08:02:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sun Jan 22 08:02:55 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sun Jan 22 08:02:56 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0037.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 08:02:56 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 08:02:56 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sun Jan 22 08:02:56 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 08:02:56 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sun Jan 22 08:02:56 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 08:02:56 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0038.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 12:00:56 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sun Jan 22 16:01:29 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 16:01:29 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sun Jan 22 16:01:29 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sun Jan 22 16:01:29 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 16:01:29 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sun Jan 22 16:01:29 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 16:01:29 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sun Jan 22 16:01:29 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 22 16:01:29 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 16:01:29 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 22 16:01:29 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sun Jan 22 16:01:29 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 16:01:29 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sun Jan 22 16:01:29 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sun Jan 22 16:01:29 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0039.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 16:01:30 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 16:01:30 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sun Jan 22 16:01:30 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 16:01:30 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sun Jan 22 16:01:30 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 16:01:30 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0040.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 22 20:01:24 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0041.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 08:02:52 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Mon Jan 23 12:01:01 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 12:01:02 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Mon Jan 23 12:01:02 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Mon Jan 23 12:01:02 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 12:01:02 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Mon Jan 23 12:01:02 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 12:01:02 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Mon Jan 23 12:01:02 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 23 12:01:02 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 12:01:02 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 23 12:01:02 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Mon Jan 23 12:01:02 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 12:01:02 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Mon Jan 23 12:01:02 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Mon Jan 23 12:01:02 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0042.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 12:01:02 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 12:01:02 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Mon Jan 23 12:01:02 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 12:01:02 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Mon Jan 23 12:01:02 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 12:01:02 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Mon Jan 23 16:02:00 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 16:02:00 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Mon Jan 23 16:02:00 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Mon Jan 23 16:02:00 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 16:02:00 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Mon Jan 23 16:02:00 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 16:02:00 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Mon Jan 23 16:02:00 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 23 16:02:00 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 16:02:00 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 23 16:02:00 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Mon Jan 23 16:02:00 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 16:02:00 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Mon Jan 23 16:02:01 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Mon Jan 23 16:02:01 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0043.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 16:02:01 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 16:02:01 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Mon Jan 23 16:02:01 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 16:02:01 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Mon Jan 23 16:02:01 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 16:02:01 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Mon Jan 23 20:00:56 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 20:00:57 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Mon Jan 23 20:00:57 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Mon Jan 23 20:00:57 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 20:00:57 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Mon Jan 23 20:00:57 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 20:00:57 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Mon Jan 23 20:00:57 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 23 20:00:57 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 20:00:57 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 23 20:00:57 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Mon Jan 23 20:00:57 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 20:00:57 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Mon Jan 23 20:00:57 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Mon Jan 23 20:00:57 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0044.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 20:00:57 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 20:00:57 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Mon Jan 23 20:00:57 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 20:00:57 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Mon Jan 23 20:00:57 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 23 20:00:57 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0045.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 08:03:22 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Tue Jan 24 12:03:19 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 12:03:19 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Tue Jan 24 12:03:19 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Tue Jan 24 12:03:19 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 12:03:20 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Tue Jan 24 12:03:20 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 12:03:20 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Tue Jan 24 12:03:20 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 24 12:03:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 12:03:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 24 12:03:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Tue Jan 24 12:03:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 12:03:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Tue Jan 24 12:03:21 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Tue Jan 24 12:03:21 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0046.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 12:03:21 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 12:03:21 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Tue Jan 24 12:03:21 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 12:03:21 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue Jan 24 12:03:21 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 12:03:21 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Tue Jan 24 16:01:33 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 16:01:34 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Tue Jan 24 16:01:34 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Tue Jan 24 16:01:34 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 16:01:34 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Tue Jan 24 16:01:34 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 16:01:34 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Tue Jan 24 16:01:34 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 24 16:01:34 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 16:01:34 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 24 16:01:34 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Tue Jan 24 16:01:34 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 16:01:34 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Tue Jan 24 16:01:34 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Tue Jan 24 16:01:34 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0047.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 16:01:34 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 16:01:34 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Tue Jan 24 16:01:34 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 16:01:34 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue Jan 24 16:01:34 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 16:01:34 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Tue Jan 24 20:02:01 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 20:02:01 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Tue Jan 24 20:02:01 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Tue Jan 24 20:02:01 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 20:02:01 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Tue Jan 24 20:02:01 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 20:02:01 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Tue Jan 24 20:02:01 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 24 20:02:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 20:02:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 24 20:02:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Tue Jan 24 20:02:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 20:02:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Tue Jan 24 20:02:01 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Tue Jan 24 20:02:02 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0048.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 20:02:02 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 20:02:02 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Tue Jan 24 20:02:02 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 20:02:02 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue Jan 24 20:02:02 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 24 20:02:02 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0049.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 08:02:12 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Jan 25 12:01:10 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 12:01:10 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Jan 25 12:01:10 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Jan 25 12:01:10 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 12:01:10 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Jan 25 12:01:10 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 12:01:10 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Jan 25 12:01:10 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Jan 25 12:01:10 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 12:01:10 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Jan 25 12:01:11 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Jan 25 12:01:11 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 12:01:11 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Jan 25 12:01:11 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Jan 25 12:01:11 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0050.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 12:01:11 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 12:01:11 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Jan 25 12:01:11 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 12:01:11 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Jan 25 12:01:11 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 12:01:11 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Jan 25 16:01:08 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 16:01:08 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Jan 25 16:01:08 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Jan 25 16:01:08 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 16:01:08 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Jan 25 16:01:08 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 16:01:08 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Jan 25 16:01:09 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Jan 25 16:01:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 16:01:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Jan 25 16:01:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Jan 25 16:01:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 16:01:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Jan 25 16:01:09 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Jan 25 16:01:09 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0051.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 16:01:09 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 16:01:09 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Jan 25 16:01:10 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 16:01:10 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Jan 25 16:01:10 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 16:01:10 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0052.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Jan 25 20:01:01 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Thu Jan 26 08:06:09 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 08:06:09 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Thu Jan 26 08:06:09 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Thu Jan 26 08:06:10 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 08:06:10 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Thu Jan 26 08:06:10 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 08:06:10 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Thu Jan 26 08:06:10 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Jan 26 08:06:10 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 08:06:10 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Jan 26 08:06:10 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Thu Jan 26 08:06:10 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 08:06:10 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Thu Jan 26 08:06:10 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Thu Jan 26 08:06:10 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0053.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 08:06:10 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 08:06:10 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Thu Jan 26 08:06:10 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 08:06:10 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Thu Jan 26 08:06:10 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 08:06:11 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0054.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 12:01:13 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0055.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 16:00:59 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0056.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Jan 26 20:00:51 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Jan 27 08:07:05 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 08:07:07 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Jan 27 08:07:07 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Jan 27 08:07:07 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 08:07:07 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Jan 27 08:07:08 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 08:07:08 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Jan 27 08:07:08 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 27 08:07:08 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 08:07:08 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 27 08:07:08 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Jan 27 08:07:08 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 08:07:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Jan 27 08:07:09 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Jan 27 08:07:09 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0057.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 08:07:09 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 08:07:09 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Jan 27 08:07:09 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 08:07:09 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Jan 27 08:07:09 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 08:07:09 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Jan 27 12:02:19 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 12:02:20 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Jan 27 12:02:20 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Jan 27 12:02:20 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 12:02:20 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Jan 27 12:02:20 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 12:02:20 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Jan 27 12:02:20 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 27 12:02:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 12:02:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 27 12:02:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Jan 27 12:02:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 12:02:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Jan 27 12:02:21 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Jan 27 12:02:21 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0058.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 12:02:21 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 12:02:21 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Jan 27 12:02:21 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 12:02:21 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Jan 27 12:02:21 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 12:02:21 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0059.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 16:01:13 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Jan 27 20:01:03 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 20:01:03 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Jan 27 20:01:03 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Jan 27 20:01:03 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 20:01:03 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Jan 27 20:01:03 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 20:01:03 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Jan 27 20:01:03 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 27 20:01:03 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 20:01:03 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Jan 27 20:01:04 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Jan 27 20:01:05 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 20:01:05 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Jan 27 20:01:05 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Jan 27 20:01:05 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0060.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 20:01:05 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 20:01:05 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Jan 27 20:01:05 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 20:01:06 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Jan 27 20:01:06 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Jan 27 20:01:06 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sat Jan 28 08:05:57 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 08:05:57 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sat Jan 28 08:05:57 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sat Jan 28 08:05:57 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 08:05:58 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sat Jan 28 08:05:58 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 08:05:58 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sat Jan 28 08:05:58 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 28 08:05:58 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 08:05:58 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 28 08:05:58 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sat Jan 28 08:05:58 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 08:05:58 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sat Jan 28 08:05:58 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sat Jan 28 08:05:58 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0061.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 08:05:59 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 08:05:59 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sat Jan 28 08:05:59 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 08:05:59 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sat Jan 28 08:05:59 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 08:05:59 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sat Jan 28 12:02:01 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 12:02:01 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sat Jan 28 12:02:01 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sat Jan 28 12:02:01 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 12:02:01 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sat Jan 28 12:02:01 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 12:02:01 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sat Jan 28 12:02:01 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 28 12:02:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 12:02:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 28 12:02:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sat Jan 28 12:02:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 12:02:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sat Jan 28 12:02:01 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sat Jan 28 12:02:01 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0062.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 12:02:02 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 12:02:02 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sat Jan 28 12:02:02 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 12:02:02 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sat Jan 28 12:02:02 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 12:02:02 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sat Jan 28 16:01:01 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 16:01:01 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sat Jan 28 16:01:01 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sat Jan 28 16:01:01 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 16:01:01 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sat Jan 28 16:01:01 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 16:01:01 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sat Jan 28 16:01:01 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 28 16:01:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 16:01:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 28 16:01:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sat Jan 28 16:01:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 16:01:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sat Jan 28 16:01:01 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sat Jan 28 16:01:01 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0063.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 16:01:02 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 16:01:02 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sat Jan 28 16:01:02 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 16:01:02 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sat Jan 28 16:01:02 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 16:01:02 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sat Jan 28 20:01:01 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 20:01:01 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sat Jan 28 20:01:01 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sat Jan 28 20:01:01 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 20:01:01 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sat Jan 28 20:01:01 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 20:01:01 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sat Jan 28 20:01:02 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 28 20:01:02 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 20:01:02 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Jan 28 20:01:02 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sat Jan 28 20:01:02 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 20:01:02 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sat Jan 28 20:01:02 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sat Jan 28 20:01:02 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0064.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 20:01:02 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 20:01:02 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sat Jan 28 20:01:02 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 20:01:02 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sat Jan 28 20:01:02 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Jan 28 20:01:02 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sun Jan 29 08:07:42 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 08:07:42 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sun Jan 29 08:07:42 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sun Jan 29 08:07:42 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 08:07:42 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sun Jan 29 08:07:42 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 08:07:42 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sun Jan 29 08:07:42 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 29 08:07:42 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 08:07:43 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 29 08:07:43 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sun Jan 29 08:07:43 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 08:07:43 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sun Jan 29 08:07:43 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sun Jan 29 08:07:43 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0065.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 08:07:43 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 08:07:43 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sun Jan 29 08:07:43 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 08:07:43 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sun Jan 29 08:07:43 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 08:07:43 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sun Jan 29 12:01:07 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 12:01:07 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sun Jan 29 12:01:07 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sun Jan 29 12:01:07 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 12:01:07 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sun Jan 29 12:01:07 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 12:01:07 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sun Jan 29 12:01:07 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 29 12:01:07 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 12:01:07 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 29 12:01:07 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sun Jan 29 12:01:07 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 12:01:08 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sun Jan 29 12:01:08 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sun Jan 29 12:01:08 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0066.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 12:01:08 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 12:01:08 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sun Jan 29 12:01:08 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 12:01:08 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sun Jan 29 12:01:08 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 12:01:08 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0067.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 16:00:59 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0068.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Jan 29 20:01:02 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Mon Jan 30 08:09:34 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 08:09:34 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Mon Jan 30 08:09:34 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Mon Jan 30 08:09:34 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 08:09:34 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Mon Jan 30 08:09:34 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 08:09:34 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Mon Jan 30 08:09:34 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 30 08:09:34 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 08:09:34 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 30 08:09:35 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Mon Jan 30 08:09:35 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 08:09:35 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Mon Jan 30 08:09:35 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Mon Jan 30 08:09:35 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0069.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 08:09:35 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 08:09:35 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Mon Jan 30 08:09:35 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 08:09:35 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Mon Jan 30 08:09:35 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 08:09:35 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0070.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 12:04:06 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Mon Jan 30 16:04:23 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 16:04:24 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Mon Jan 30 16:04:24 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Mon Jan 30 16:04:24 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 16:04:24 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Mon Jan 30 16:04:24 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 16:04:24 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Mon Jan 30 16:04:24 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 30 16:04:24 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 16:04:24 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 30 16:04:24 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Mon Jan 30 16:04:24 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 16:04:24 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Mon Jan 30 16:04:25 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Mon Jan 30 16:04:25 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0071.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 16:04:25 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 16:04:25 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Mon Jan 30 16:04:25 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 16:04:25 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Mon Jan 30 16:04:25 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 16:04:25 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Mon Jan 30 20:02:22 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 20:02:22 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Mon Jan 30 20:02:22 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Mon Jan 30 20:02:22 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 20:02:22 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Mon Jan 30 20:02:22 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 20:02:22 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Mon Jan 30 20:02:22 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 30 20:02:23 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 20:02:23 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Jan 30 20:02:23 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Mon Jan 30 20:02:23 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 20:02:23 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Mon Jan 30 20:02:23 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Mon Jan 30 20:02:23 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0072.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 20:02:23 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 20:02:23 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Mon Jan 30 20:02:23 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 20:02:23 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Mon Jan 30 20:02:23 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Jan 30 20:02:24 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Tue Jan 31 08:08:09 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 08:08:09 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Tue Jan 31 08:08:09 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Tue Jan 31 08:08:09 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 08:08:09 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Tue Jan 31 08:08:09 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 08:08:09 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Tue Jan 31 08:08:09 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 31 08:08:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 08:08:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 31 08:08:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Tue Jan 31 08:08:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 08:08:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Tue Jan 31 08:08:09 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Tue Jan 31 08:08:09 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0073.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 08:08:10 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 08:08:10 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Tue Jan 31 08:08:10 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 08:08:10 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue Jan 31 08:08:10 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 08:08:10 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Tue Jan 31 12:04:29 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 12:04:29 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Tue Jan 31 12:04:29 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Tue Jan 31 12:04:29 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 12:04:29 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Tue Jan 31 12:04:29 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 12:04:29 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Tue Jan 31 12:04:30 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 31 12:04:30 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 12:04:30 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 31 12:04:30 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Tue Jan 31 12:04:30 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 12:04:30 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Tue Jan 31 12:04:30 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Tue Jan 31 12:04:30 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0074.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 12:04:30 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 12:04:30 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Tue Jan 31 12:04:30 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 12:04:30 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue Jan 31 12:04:30 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 12:04:30 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0075.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 16:02:30 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0076.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Jan 31 20:01:15 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Feb 1 08:10:16 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 08:10:17 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Feb 1 08:10:17 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Feb 1 08:10:17 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 08:10:17 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Feb 1 08:10:17 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 08:10:17 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Feb 1 08:10:17 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 1 08:10:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 08:10:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 1 08:10:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Feb 1 08:10:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 08:10:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Feb 1 08:10:17 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Feb 1 08:10:17 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0077.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 08:10:17 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 08:10:17 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Feb 1 08:10:17 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 08:10:17 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Feb 1 08:10:17 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 08:10:17 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Feb 1 12:02:52 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 12:02:52 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Feb 1 12:02:52 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Feb 1 12:02:52 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 12:02:52 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Feb 1 12:02:52 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 12:02:52 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Feb 1 12:02:52 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 1 12:02:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 12:02:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 1 12:02:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Feb 1 12:02:52 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 12:02:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Feb 1 12:02:53 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Feb 1 12:02:53 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0078.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 12:02:53 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 12:02:53 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Feb 1 12:02:53 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 12:02:53 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Feb 1 12:02:53 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 12:02:53 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0079.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 16:01:14 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0080.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 1 20:01:09 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Thu Feb 2 08:13:40 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 08:13:41 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Thu Feb 2 08:13:41 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Thu Feb 2 08:13:41 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 08:13:41 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Thu Feb 2 08:13:41 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 08:13:41 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Thu Feb 2 08:13:41 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Feb 2 08:13:41 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 08:13:41 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Feb 2 08:13:41 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Thu Feb 2 08:13:42 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 08:13:42 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Thu Feb 2 08:13:42 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Thu Feb 2 08:13:42 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0081.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 08:13:42 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 08:13:43 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Thu Feb 2 08:13:43 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 08:13:43 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Thu Feb 2 08:13:43 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 08:13:43 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Thu Feb 2 12:03:00 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 12:03:00 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Thu Feb 2 12:03:00 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Thu Feb 2 12:03:00 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 12:03:00 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Thu Feb 2 12:03:00 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 12:03:00 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Thu Feb 2 12:03:00 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Feb 2 12:03:00 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 12:03:00 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Feb 2 12:03:00 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Thu Feb 2 12:03:00 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 12:03:00 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Thu Feb 2 12:03:01 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Thu Feb 2 12:03:01 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0082.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 12:03:01 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 12:03:01 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Thu Feb 2 12:03:01 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 12:03:01 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Thu Feb 2 12:03:01 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 12:03:01 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Thu Feb 2 16:01:18 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 16:01:18 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Thu Feb 2 16:01:18 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Thu Feb 2 16:01:19 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 16:01:19 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Thu Feb 2 16:01:19 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 16:01:20 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Thu Feb 2 16:01:20 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Feb 2 16:01:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 16:01:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Feb 2 16:01:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Thu Feb 2 16:01:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 16:01:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Thu Feb 2 16:01:20 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Thu Feb 2 16:01:20 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0083.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 16:01:20 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 16:01:20 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Thu Feb 2 16:01:20 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 16:01:20 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Thu Feb 2 16:01:20 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 16:01:20 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Thu Feb 2 20:01:08 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 20:01:08 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Thu Feb 2 20:01:08 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Thu Feb 2 20:01:08 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 20:01:08 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Thu Feb 2 20:01:08 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 20:01:08 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Thu Feb 2 20:01:08 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Feb 2 20:01:08 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 20:01:08 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Feb 2 20:01:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Thu Feb 2 20:01:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 20:01:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Thu Feb 2 20:01:09 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Thu Feb 2 20:01:09 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0084.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 20:01:09 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 20:01:09 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Thu Feb 2 20:01:09 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 20:01:09 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Thu Feb 2 20:01:09 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 2 20:01:09 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Feb 3 08:12:46 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 08:12:48 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Feb 3 08:12:48 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Feb 3 08:12:48 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 08:12:48 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Feb 3 08:12:48 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 08:12:49 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Feb 3 08:12:49 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Feb 3 08:12:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 08:12:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Feb 3 08:12:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Feb 3 08:12:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 08:12:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Feb 3 08:12:50 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Feb 3 08:12:50 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0085.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 08:12:51 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 08:12:51 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Feb 3 08:12:51 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 08:12:51 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Feb 3 08:12:52 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 08:12:52 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0086.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 12:02:55 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Feb 3 16:01:10 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 16:01:10 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Feb 3 16:01:10 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Feb 3 16:01:11 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 16:01:11 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Feb 3 16:01:11 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 16:01:11 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Feb 3 16:01:11 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Feb 3 16:01:11 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 16:01:11 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Feb 3 16:01:11 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Feb 3 16:01:11 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 16:01:11 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Feb 3 16:01:11 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Feb 3 16:01:11 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0087.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 16:01:11 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 16:01:11 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Feb 3 16:01:11 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 16:01:11 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Feb 3 16:01:11 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 16:01:11 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0088.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 3 20:01:15 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sat Feb 4 08:08:29 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 08:08:30 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sat Feb 4 08:08:30 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sat Feb 4 08:08:30 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 08:08:30 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sat Feb 4 08:08:30 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 08:08:30 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sat Feb 4 08:08:30 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Feb 4 08:08:30 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 08:08:30 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Feb 4 08:08:30 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sat Feb 4 08:08:30 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 08:08:30 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sat Feb 4 08:08:30 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sat Feb 4 08:08:31 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0089.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 08:08:31 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 08:08:31 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sat Feb 4 08:08:31 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 08:08:31 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sat Feb 4 08:08:31 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 08:08:31 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sat Feb 4 12:02:53 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 12:02:53 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sat Feb 4 12:02:53 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sat Feb 4 12:02:53 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 12:02:53 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sat Feb 4 12:02:53 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 12:02:53 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sat Feb 4 12:02:53 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Feb 4 12:02:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 12:02:54 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Feb 4 12:02:54 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sat Feb 4 12:02:54 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 12:02:54 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sat Feb 4 12:02:54 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sat Feb 4 12:02:54 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0090.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 12:02:54 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 12:02:54 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sat Feb 4 12:02:54 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 12:02:54 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sat Feb 4 12:02:54 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 12:02:54 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0091.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 16:01:20 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sat Feb 4 20:01:12 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 20:01:12 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sat Feb 4 20:01:12 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sat Feb 4 20:01:12 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 20:01:12 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sat Feb 4 20:01:12 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 20:01:12 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sat Feb 4 20:01:12 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Feb 4 20:01:12 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 20:01:12 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Feb 4 20:01:12 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sat Feb 4 20:01:12 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 20:01:13 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sat Feb 4 20:01:13 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sat Feb 4 20:01:13 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0092.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 20:01:13 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 20:01:13 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sat Feb 4 20:01:13 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 20:01:13 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sat Feb 4 20:01:13 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 4 20:01:13 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0093.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 08:08:07 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sun Feb 5 12:02:54 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 12:02:54 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sun Feb 5 12:02:54 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sun Feb 5 12:02:54 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 12:02:54 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sun Feb 5 12:02:54 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 12:02:54 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sun Feb 5 12:02:54 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Feb 5 12:02:54 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 12:02:54 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Feb 5 12:02:54 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sun Feb 5 12:02:54 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 12:02:54 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sun Feb 5 12:02:54 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sun Feb 5 12:02:55 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0094.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 12:02:55 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 12:02:55 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sun Feb 5 12:02:55 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 12:02:55 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sun Feb 5 12:02:56 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 12:02:56 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sun Feb 5 16:01:16 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 16:01:16 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sun Feb 5 16:01:16 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sun Feb 5 16:01:16 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 16:01:16 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sun Feb 5 16:01:16 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 16:01:16 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sun Feb 5 16:01:16 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Feb 5 16:01:16 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 16:01:16 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Feb 5 16:01:16 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sun Feb 5 16:01:16 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 16:01:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sun Feb 5 16:01:17 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sun Feb 5 16:01:17 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0095.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 16:01:17 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 16:01:17 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sun Feb 5 16:01:17 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 16:01:17 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sun Feb 5 16:01:17 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 16:01:17 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0096.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 5 20:01:06 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Mon Feb 6 08:16:02 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 08:16:03 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Mon Feb 6 08:16:03 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Mon Feb 6 08:16:03 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 08:16:03 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Mon Feb 6 08:16:03 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 08:16:03 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Mon Feb 6 08:16:03 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Feb 6 08:16:03 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 08:16:03 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Feb 6 08:16:04 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Mon Feb 6 08:16:04 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 08:16:04 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Mon Feb 6 08:16:04 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Mon Feb 6 08:16:04 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0097.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 08:16:04 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 08:16:04 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Mon Feb 6 08:16:04 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 08:16:04 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Mon Feb 6 08:16:04 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 08:16:04 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Mon Feb 6 12:02:54 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 12:02:54 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Mon Feb 6 12:02:54 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Mon Feb 6 12:02:54 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 12:02:55 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Mon Feb 6 12:02:55 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 12:02:55 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Mon Feb 6 12:02:55 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Feb 6 12:02:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 12:02:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Feb 6 12:02:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Mon Feb 6 12:02:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 12:02:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Mon Feb 6 12:02:55 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Mon Feb 6 12:02:55 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0098.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 12:02:55 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 12:02:55 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Mon Feb 6 12:02:55 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 12:02:55 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Mon Feb 6 12:02:55 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 12:02:55 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Mon Feb 6 16:01:14 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 16:01:14 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Mon Feb 6 16:01:14 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Mon Feb 6 16:01:14 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 16:01:14 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Mon Feb 6 16:01:14 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 16:01:14 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Mon Feb 6 16:01:14 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Feb 6 16:01:14 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 16:01:14 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Feb 6 16:01:14 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Mon Feb 6 16:01:14 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 16:01:14 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Mon Feb 6 16:01:14 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Mon Feb 6 16:01:14 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0099.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 16:01:14 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 16:01:14 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Mon Feb 6 16:01:14 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 16:01:15 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Mon Feb 6 16:01:15 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 16:01:15 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Mon Feb 6 20:01:06 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 20:01:06 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Mon Feb 6 20:01:06 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Mon Feb 6 20:01:06 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 20:01:06 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Mon Feb 6 20:01:06 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 20:01:06 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Mon Feb 6 20:01:06 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Feb 6 20:01:06 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 20:01:07 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Feb 6 20:01:07 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Mon Feb 6 20:01:07 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 20:01:07 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Mon Feb 6 20:01:07 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Mon Feb 6 20:01:07 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0100.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 20:01:07 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 20:01:07 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Mon Feb 6 20:01:07 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 20:01:07 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Mon Feb 6 20:01:07 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 6 20:01:07 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Tue Feb 7 08:25:28 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 08:25:32 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Tue Feb 7 08:25:32 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Tue Feb 7 08:25:32 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 08:25:32 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Tue Feb 7 08:25:32 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 08:25:32 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Tue Feb 7 08:25:32 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Feb 7 08:25:32 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 08:25:32 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Feb 7 08:25:32 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Tue Feb 7 08:25:32 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 08:25:32 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Tue Feb 7 08:25:32 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Tue Feb 7 08:25:32 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0101.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 08:25:33 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 08:25:34 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Tue Feb 7 08:25:34 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 08:25:34 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue Feb 7 08:25:34 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 08:25:34 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Tue Feb 7 12:03:33 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 12:03:33 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Tue Feb 7 12:03:33 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Tue Feb 7 12:03:33 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 12:03:33 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Tue Feb 7 12:03:33 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 12:03:33 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Tue Feb 7 12:03:33 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Feb 7 12:03:33 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 12:03:33 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Feb 7 12:03:34 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Tue Feb 7 12:03:34 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 12:03:34 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Tue Feb 7 12:03:34 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Tue Feb 7 12:03:34 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0102.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 12:03:34 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 12:03:34 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Tue Feb 7 12:03:34 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 12:03:34 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue Feb 7 12:03:34 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 12:03:34 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Tue Feb 7 16:01:15 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 16:01:15 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Tue Feb 7 16:01:15 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Tue Feb 7 16:01:15 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 16:01:15 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Tue Feb 7 16:01:15 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 16:01:15 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Tue Feb 7 16:01:15 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Feb 7 16:01:15 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 16:01:15 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Feb 7 16:01:15 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Tue Feb 7 16:01:15 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 16:01:16 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Tue Feb 7 16:01:16 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Tue Feb 7 16:01:16 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0103.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 16:01:16 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 16:01:16 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Tue Feb 7 16:01:16 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 16:01:16 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue Feb 7 16:01:16 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 16:01:16 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Tue Feb 7 20:01:11 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 20:01:11 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Tue Feb 7 20:01:11 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Tue Feb 7 20:01:11 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 20:01:11 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Tue Feb 7 20:01:11 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 20:01:11 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Tue Feb 7 20:01:11 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Feb 7 20:01:11 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 20:01:11 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Feb 7 20:01:11 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Tue Feb 7 20:01:11 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 20:01:11 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Tue Feb 7 20:01:11 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Tue Feb 7 20:01:11 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0104.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 20:01:11 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 20:01:11 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Tue Feb 7 20:01:11 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 20:01:13 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue Feb 7 20:01:13 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 7 20:01:13 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Feb 8 08:24:01 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 08:24:03 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Feb 8 08:24:03 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Feb 8 08:24:04 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 08:24:04 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Feb 8 08:24:04 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 08:24:04 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Feb 8 08:24:04 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 8 08:24:04 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 08:24:04 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 8 08:24:04 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Feb 8 08:24:04 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 08:24:05 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Feb 8 08:24:05 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Feb 8 08:24:05 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0105.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 08:24:05 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 08:24:06 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Feb 8 08:24:06 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 08:24:06 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Feb 8 08:24:06 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 08:24:06 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0106.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 12:03:35 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Feb 8 16:01:26 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 16:01:26 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Feb 8 16:01:26 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Feb 8 16:01:26 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 16:01:26 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Feb 8 16:01:26 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 16:01:26 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Feb 8 16:01:26 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 8 16:01:26 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 16:01:26 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 8 16:01:26 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Feb 8 16:01:26 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 16:01:26 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Feb 8 16:01:26 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Feb 8 16:01:26 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0107.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 16:01:26 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 16:01:27 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Feb 8 16:01:27 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 16:01:27 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Feb 8 16:01:27 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 16:01:27 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0108.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 8 20:01:11 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Thu Feb 9 08:09:59 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 08:10:01 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Thu Feb 9 08:10:01 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Thu Feb 9 08:10:02 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 08:10:02 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Thu Feb 9 08:10:02 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 08:10:02 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Thu Feb 9 08:10:02 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Feb 9 08:10:02 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 08:10:02 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Feb 9 08:10:02 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Thu Feb 9 08:10:02 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 08:10:02 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Thu Feb 9 08:10:02 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Thu Feb 9 08:10:02 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0109.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 08:10:02 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 08:10:02 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Thu Feb 9 08:10:02 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 08:10:02 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Thu Feb 9 08:10:02 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 08:10:03 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Thu Feb 9 12:03:27 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 12:03:28 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Thu Feb 9 12:03:28 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Thu Feb 9 12:03:28 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 12:03:28 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Thu Feb 9 12:03:28 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 12:03:28 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Thu Feb 9 12:03:28 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Feb 9 12:03:28 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 12:03:28 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Feb 9 12:03:28 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Thu Feb 9 12:03:28 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 12:03:28 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Thu Feb 9 12:03:28 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Thu Feb 9 12:03:28 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0110.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 12:03:28 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 12:03:28 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Thu Feb 9 12:03:28 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 12:03:28 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Thu Feb 9 12:03:28 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 12:03:28 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Thu Feb 9 16:01:24 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 16:01:24 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Thu Feb 9 16:01:24 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Thu Feb 9 16:01:24 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 16:01:24 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Thu Feb 9 16:01:24 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 16:01:24 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Thu Feb 9 16:01:24 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Feb 9 16:01:24 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 16:01:24 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Feb 9 16:01:24 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Thu Feb 9 16:01:24 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 16:01:25 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Thu Feb 9 16:01:25 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Thu Feb 9 16:01:25 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0111.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 16:01:25 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 16:01:25 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Thu Feb 9 16:01:25 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 16:01:25 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Thu Feb 9 16:01:25 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 16:01:25 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Thu Feb 9 20:01:18 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 20:01:18 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Thu Feb 9 20:01:18 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Thu Feb 9 20:01:18 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 20:01:18 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Thu Feb 9 20:01:18 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 20:01:19 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Thu Feb 9 20:01:19 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Feb 9 20:01:19 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 20:01:19 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Feb 9 20:01:19 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Thu Feb 9 20:01:19 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 20:01:19 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Thu Feb 9 20:01:19 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Thu Feb 9 20:01:19 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0112.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 20:01:19 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 20:01:19 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Thu Feb 9 20:01:19 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 20:01:19 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Thu Feb 9 20:01:19 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 9 20:01:19 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Feb 10 08:21:38 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 08:21:40 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Feb 10 08:21:40 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Feb 10 08:21:40 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 08:21:41 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Feb 10 08:21:41 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 08:21:41 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Feb 10 08:21:41 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Feb 10 08:21:42 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 08:21:42 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Feb 10 08:21:42 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Feb 10 08:21:42 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 08:21:43 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Feb 10 08:21:43 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Feb 10 08:21:43 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0113.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 08:21:43 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 08:21:43 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Feb 10 08:21:43 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 08:21:43 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Feb 10 08:21:43 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 08:21:43 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Feb 10 12:03:49 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 12:03:49 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Feb 10 12:03:49 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Feb 10 12:03:49 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 12:03:49 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Feb 10 12:03:49 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 12:03:49 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Feb 10 12:03:49 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Feb 10 12:03:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 12:03:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Feb 10 12:03:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Feb 10 12:03:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 12:03:49 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Feb 10 12:03:49 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Feb 10 12:03:50 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0114.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 12:03:50 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 12:03:50 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Feb 10 12:03:50 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 12:03:50 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Feb 10 12:03:50 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 12:03:50 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0115.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 16:01:17 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0116.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Feb 10 20:01:19 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sat Feb 11 08:13:19 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 08:13:20 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sat Feb 11 08:13:20 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sat Feb 11 08:13:20 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 08:13:20 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sat Feb 11 08:13:20 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 08:13:20 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sat Feb 11 08:13:20 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Feb 11 08:13:21 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 08:13:21 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Feb 11 08:13:21 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sat Feb 11 08:13:21 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 08:13:21 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sat Feb 11 08:13:21 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sat Feb 11 08:13:21 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0117.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 08:13:21 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 08:13:22 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sat Feb 11 08:13:22 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 08:13:22 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sat Feb 11 08:13:22 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 08:13:22 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sat Feb 11 12:02:53 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 12:02:54 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sat Feb 11 12:02:54 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sat Feb 11 12:02:54 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 12:02:54 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sat Feb 11 12:02:54 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 12:02:54 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sat Feb 11 12:02:54 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Feb 11 12:02:54 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 12:02:54 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Feb 11 12:02:54 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sat Feb 11 12:02:54 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 12:02:54 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sat Feb 11 12:02:55 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sat Feb 11 12:02:55 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0118.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 12:02:55 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 12:02:55 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sat Feb 11 12:02:55 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 12:02:55 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sat Feb 11 12:02:55 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 12:02:55 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sat Feb 11 16:01:13 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 16:01:13 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sat Feb 11 16:01:13 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sat Feb 11 16:01:13 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 16:01:13 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sat Feb 11 16:01:13 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 16:01:13 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sat Feb 11 16:01:13 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Feb 11 16:01:14 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 16:01:14 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Feb 11 16:01:14 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sat Feb 11 16:01:14 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 16:01:14 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sat Feb 11 16:01:14 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sat Feb 11 16:01:14 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0119.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 16:01:14 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 16:01:14 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sat Feb 11 16:01:14 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 16:01:14 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sat Feb 11 16:01:14 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 16:01:14 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sat Feb 11 20:01:03 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 20:01:03 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sat Feb 11 20:01:03 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sat Feb 11 20:01:03 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 20:01:03 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sat Feb 11 20:01:03 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 20:01:03 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sat Feb 11 20:01:03 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Feb 11 20:01:03 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 20:01:03 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sat Feb 11 20:01:04 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sat Feb 11 20:01:04 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 20:01:04 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sat Feb 11 20:01:04 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sat Feb 11 20:01:04 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0120.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 20:01:04 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 20:01:04 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sat Feb 11 20:01:04 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 20:01:04 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sat Feb 11 20:01:04 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sat Feb 11 20:01:04 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sun Feb 12 08:09:54 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 08:09:55 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sun Feb 12 08:09:55 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sun Feb 12 08:09:55 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 08:09:55 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sun Feb 12 08:09:55 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 08:09:55 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sun Feb 12 08:09:55 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Feb 12 08:09:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 08:09:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Feb 12 08:09:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sun Feb 12 08:09:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 08:09:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sun Feb 12 08:09:56 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sun Feb 12 08:09:56 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0121.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 08:09:57 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 08:09:57 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sun Feb 12 08:09:57 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 08:09:58 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sun Feb 12 08:09:58 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 08:09:58 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sun Feb 12 12:02:59 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 12:02:59 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sun Feb 12 12:02:59 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sun Feb 12 12:02:59 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 12:02:59 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sun Feb 12 12:02:59 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 12:02:59 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sun Feb 12 12:02:59 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Feb 12 12:02:59 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 12:02:59 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Feb 12 12:02:59 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sun Feb 12 12:02:59 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 12:02:59 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sun Feb 12 12:02:59 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sun Feb 12 12:02:59 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0122.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 12:03:00 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 12:03:00 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sun Feb 12 12:03:00 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 12:03:00 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sun Feb 12 12:03:00 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 12:03:00 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sun Feb 12 16:01:17 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 16:01:17 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sun Feb 12 16:01:17 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sun Feb 12 16:01:17 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 16:01:17 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sun Feb 12 16:01:17 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 16:01:17 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sun Feb 12 16:01:17 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Feb 12 16:01:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 16:01:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Feb 12 16:01:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sun Feb 12 16:01:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 16:01:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sun Feb 12 16:01:17 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sun Feb 12 16:01:17 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0123.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 16:01:17 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 16:01:17 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sun Feb 12 16:01:17 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 16:01:18 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sun Feb 12 16:01:18 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 16:01:18 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Sun Feb 12 20:01:09 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 20:01:09 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Sun Feb 12 20:01:09 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Sun Feb 12 20:01:09 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 20:01:09 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Sun Feb 12 20:01:10 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 20:01:10 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Sun Feb 12 20:01:10 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Feb 12 20:01:10 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 20:01:10 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Sun Feb 12 20:01:10 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Sun Feb 12 20:01:10 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 20:01:10 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Sun Feb 12 20:01:10 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Sun Feb 12 20:01:10 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0124.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 20:01:10 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 20:01:10 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Sun Feb 12 20:01:10 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 20:01:10 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Sun Feb 12 20:01:10 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Sun Feb 12 20:01:10 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Mon Feb 13 08:17:52 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 08:17:53 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Mon Feb 13 08:17:53 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Mon Feb 13 08:17:53 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 08:17:55 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Mon Feb 13 08:17:55 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 08:17:55 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Mon Feb 13 08:17:55 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Feb 13 08:17:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 08:17:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Feb 13 08:17:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Mon Feb 13 08:17:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 08:17:56 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Mon Feb 13 08:17:56 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Mon Feb 13 08:17:57 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0125.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 08:17:57 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 08:17:57 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Mon Feb 13 08:17:57 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 08:17:57 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Mon Feb 13 08:17:57 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 08:17:57 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Mon Feb 13 12:03:18 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 12:03:18 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Mon Feb 13 12:03:18 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Mon Feb 13 12:03:18 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 12:03:18 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Mon Feb 13 12:03:19 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 12:03:19 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Mon Feb 13 12:03:19 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Feb 13 12:03:19 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 12:03:19 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Feb 13 12:03:19 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Mon Feb 13 12:03:19 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 12:03:19 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Mon Feb 13 12:03:19 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Mon Feb 13 12:03:19 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0126.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 12:03:19 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 12:03:19 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Mon Feb 13 12:03:19 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 12:03:19 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Mon Feb 13 12:03:19 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 12:03:19 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Mon Feb 13 16:01:33 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 16:01:33 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Mon Feb 13 16:01:33 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Mon Feb 13 16:01:33 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 16:01:33 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Mon Feb 13 16:01:33 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 16:01:34 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Mon Feb 13 16:01:34 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Feb 13 16:01:34 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 16:01:34 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Feb 13 16:01:34 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Mon Feb 13 16:01:34 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 16:01:34 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Mon Feb 13 16:01:34 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Mon Feb 13 16:01:34 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0127.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 16:01:34 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 16:01:34 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Mon Feb 13 16:01:34 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 16:01:34 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Mon Feb 13 16:01:34 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 16:01:34 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0128.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Mon Feb 13 20:01:17 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Tue Feb 14 08:20:07 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 08:20:08 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Tue Feb 14 08:20:08 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Tue Feb 14 08:20:08 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 08:20:08 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Tue Feb 14 08:20:08 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 08:20:08 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Tue Feb 14 08:20:08 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Feb 14 08:20:08 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 08:20:08 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Feb 14 08:20:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Tue Feb 14 08:20:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 08:20:09 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Tue Feb 14 08:20:09 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Tue Feb 14 08:20:09 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0129.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 08:20:09 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 08:20:09 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Tue Feb 14 08:20:09 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 08:20:09 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue Feb 14 08:20:09 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 08:20:09 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0130.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 12:03:34 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Tue Feb 14 16:01:45 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 16:01:45 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Tue Feb 14 16:01:45 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Tue Feb 14 16:01:45 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 16:01:45 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Tue Feb 14 16:01:45 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 16:01:45 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Tue Feb 14 16:01:45 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Feb 14 16:01:45 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 16:01:45 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Feb 14 16:01:46 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Tue Feb 14 16:01:46 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 16:01:46 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Tue Feb 14 16:01:46 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Tue Feb 14 16:01:46 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0131.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 16:01:46 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 16:01:46 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Tue Feb 14 16:01:46 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 16:01:46 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue Feb 14 16:01:46 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 16:01:46 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Tue Feb 14 20:01:17 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 20:01:17 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Tue Feb 14 20:01:17 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Tue Feb 14 20:01:17 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 20:01:17 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Tue Feb 14 20:01:17 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 20:01:17 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Tue Feb 14 20:01:18 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Feb 14 20:01:18 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 20:01:18 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Tue Feb 14 20:01:18 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Tue Feb 14 20:01:18 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 20:01:18 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Tue Feb 14 20:01:18 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Tue Feb 14 20:01:20 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0132.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 20:01:20 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 20:01:20 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Tue Feb 14 20:01:20 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 20:01:20 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue Feb 14 20:01:20 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Tue Feb 14 20:01:20 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Feb 15 08:29:57 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 08:30:00 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Feb 15 08:30:00 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Feb 15 08:30:00 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 08:30:00 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Feb 15 08:30:00 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 08:30:00 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Feb 15 08:30:00 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 15 08:30:00 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 08:30:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 15 08:30:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Feb 15 08:30:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 08:30:01 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Feb 15 08:30:01 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Feb 15 08:30:02 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0133.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 08:30:03 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 08:30:04 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Feb 15 08:30:04 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 08:30:04 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Feb 15 08:30:04 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 08:30:04 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Feb 15 12:05:42 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 12:05:42 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Feb 15 12:05:42 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Feb 15 12:05:42 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 12:05:42 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Feb 15 12:05:42 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 12:05:42 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Feb 15 12:05:43 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 15 12:05:43 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 12:05:43 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 15 12:05:43 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Feb 15 12:05:43 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 12:05:43 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Feb 15 12:05:43 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Feb 15 12:05:43 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0134.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 12:05:43 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 12:05:43 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Feb 15 12:05:43 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 12:05:43 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Feb 15 12:05:43 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 12:05:43 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0135.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 16:01:42 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Feb 15 19:28:14 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 19:28:14 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Feb 15 19:28:14 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Feb 15 19:28:14 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 19:28:14 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Feb 15 19:28:14 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 19:28:14 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Feb 15 19:28:14 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 15 19:28:14 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 19:28:14 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 15 19:28:14 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Feb 15 19:28:14 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 19:28:14 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Feb 15 19:28:14 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Feb 15 19:28:14 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0136.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 19:28:14 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 19:28:15 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Feb 15 19:28:15 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 19:28:15 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Feb 15 19:28:15 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 19:28:15 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Wed Feb 15 20:14:16 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 20:14:18 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Wed Feb 15 20:14:18 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Wed Feb 15 20:14:18 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 20:14:18 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Wed Feb 15 20:14:19 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 20:14:19 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Wed Feb 15 20:14:19 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 15 20:14:19 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 20:14:19 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Wed Feb 15 20:14:19 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Wed Feb 15 20:14:19 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 20:14:19 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed Feb 15 20:14:20 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Wed Feb 15 20:14:21 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0137.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 20:14:21 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 20:14:21 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Wed Feb 15 20:14:21 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 20:14:21 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Wed Feb 15 20:14:21 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Wed Feb 15 20:14:21 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Thu Feb 16 08:47:47 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 16 08:47:50 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Thu Feb 16 08:47:50 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Thu Feb 16 08:47:50 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 16 08:47:50 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Thu Feb 16 08:47:50 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 16 08:47:52 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Thu Feb 16 08:47:52 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Feb 16 08:47:53 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 16 08:47:54 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Thu Feb 16 08:47:54 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Thu Feb 16 08:47:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 16 08:47:55 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Thu Feb 16 08:47:55 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Thu Feb 16 08:47:57 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0138.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 16 08:47:57 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 16 08:47:58 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Thu Feb 16 08:47:59 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 16 08:47:59 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Thu Feb 16 08:47:59 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Thu Feb 16 08:47:59 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From erich.birrer at birrer-edv.ch Thu Nov 4 18:16:46 2004 From: erich.birrer at birrer-edv.ch (Erich Birrer-Uster) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] No Available Datasources Message-ID: <002001c4c292$115e1a10$0300000a@NB1> I try to open a connection to the database and I get this error message: Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX Connection pool entry: 0 Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben', 7947) When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. What can be wrong? I use Windows XP Prof SP2 Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 mxODBC Zope DA 1.0.8 Erich From mal at egenix.com Thu Nov 4 20:29:29 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] No Available Datasources In-Reply-To: <002001c4c292$115e1a10$0300000a@NB1> References: <002001c4c292$115e1a10$0300000a@NB1> Message-ID: <418A8319.8060801@egenix.com> Erich Birrer-Uster wrote: > I try to open a connection to the database and I get this error message: > > Connection string: DSN=e3000;UID=user02;PWD=XXXXXXXX > > Connection pool entry: 0 > > Error message: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben', 7947) > > When I display the available datasources no one is listed although I can see them in the Windows ODBC Manager. > > What can be wrong? How did you setup the data sources ? It is well possible that the Zope process does not have permission to access the data sources. If you're running Zope as a service, the easiest way to enable access works as follows: Change the "Log on as:" option of the service to be the Local System account. * Select the Start menu > Settings > Control Panel > Administrative Tools > Services. * Highlight the service. * Right-click on the service and choose Properties * Select the Log On tab. * Change the Log on as: option to be Local System account. Click OK. * Restart the service. Note that it is probably better to setup the data sources as user data sources (for the Zope user). The above will run Zope under the system account. Another issue that you may face after upgrading to XP SP2 is that of the firewall blocking access to the database. In such a case, please see the instructions of the ODBC driver vendor on how to reenable connectivity. For SQL Server, this article should help: http://support.microsoft.com/default.aspx?scid=kb;en-us;841394 > I use > Windows XP Prof SP2 > Python Version 2.3.3 (#51, Dec 18 2003, 20:22:39) > Zope Version (unreleased version, python 2.3.3, win32) installed with Plone 2.0.4 > mxODBC Zope DA 1.0.8 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 04 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From contractor6 at match.com Tue Nov 9 11:02:05 2004 From: contractor6 at match.com (Rodney Caston) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] Errors after install Message-ID: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> # python2 Python 2.2.2 (#1, Jan 30 2003, 21:26:22) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mx >>> import mx.iODBC Traceback (most recent call last): File "", line 1, in ? ImportError: No module named iODBC >>> import mx.ODBC >>> import mx.ODBC.iODBC Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString >>> anyone know whats wrong? Install is on redhat7.3 box. From charlie at egenix.com Tue Nov 9 18:21:16 2004 From: charlie at egenix.com (Charlie Clark) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp > References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <20041109182116.38484.16@Zeta.1099990222.fake> Dear Mr. Caston, this is a common error on newer Linux distributions which have Python compiled with UCS_4 while mxODBC requires UCS_2. While the next release of mxODBC will support UCS_4, currently you will have to recompile Python with UCS_2 support yourself. Regards Charlie Clark On 2004-11-09 at 18:02:05 [+0100], Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mx > >>> import mx.iODBC > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>> import mx.ODBC > >>> import mx.ODBC.iODBC > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > >>> > > > anyone know whats wrong? > > Install is on redhat7.3 box. From mal at egenix.com Tue Nov 9 21:35:24 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] Errors after install In-Reply-To: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> References: <573F1E2597A7974E924A5F814CAC166D0DF27D77@da0shme010.match.corp> Message-ID: <41912A0C.9090405@egenix.com> Rodney Caston wrote: > # python2 > Python 2.2.2 (#1, Jan 30 2003, 21:26:22) > [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import mx >>>>import mx.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named iODBC > >>>>import mx.ODBC >>>>import mx.ODBC.iODBC > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: /usr/lib/python2.2/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString > > > > anyone know whats wrong? > > Install is on redhat7.3 box. This error indicates that you are using a UCS4 build of Python with Zope. Please try the RedHat9 pre-release instead (this is a UCS4 build of the Zope DA). We will start shipping all future releases of the software as both UCS2 (default Python) and UCS4 (default on many *nix distributions as of this year) builds. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 09 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From zxo102 at yahoo.com Wed Nov 10 04:34:53 2004 From: zxo102 at yahoo.com (zhihua ouyang) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] unicode, sql command, mxODBC Message-ID: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Hi everyone, I need your help. I have tried for a while to make unicoded sql command work with mxODBC in window xp(Chinese Version) but failed since some unicode chinese characters are in it. Here is my case: 1. A Excel file in c:\\test.xls which contains chinese characters. 2. I got the data from test.xls using the following code from win32com.client import DispatchEx xApp = DispatchEx("Excel.Application") xBook = xApp.Workbooks.Open('c:\\test.xls') sheet = xBook.Worksheets('sheet1') aaa = [] for i in range(10): aaa.append(sheet.Cell(5,i).Value) ...... and generate sql command dynamically with those chinese data. The following is an example: sqlCommandStr = u"INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" But mxODBC gives error info: "sql command must be a string". If chinese characters are inserted into the sql command like "INSERT INTO instruments VALUES ('0401', 23800.0, 0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');" everything is fine. But I don't know how to generate it in above condition. Does mxODBC accept the unicoded sql command? Thanks. Ouyang __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Wed Nov 10 13:53:57 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: <41920F65.4000500@egenix.com> zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? No; SQL commands can however be encoded using the encoding supported by the database engine (you usually have to set this up in the database configuration). Using UTF-8 usually goes a long way and is supported by most database backends allowing Unicode to be stored in the database. Another strategy is passing in Unicode as bound parameter. This is support by mxODBC and works well with SQL Server and Access. You'd have to rewrite you execute command using bound parameters: cursor.execute('insert into tablename values (?,?,?)', (123, u'name', u'text')) There's a catch though: For backwards compatiblity reasons, mxODBC runs in 8-bit only mode if not told otherwise. To have mxODBC connections run in native Unicode mode you have to set them up using the .stringformat attribute: connection = mx.ODBC.Windows.DriverConnect(...) connection.stringformat = mx.ODBC.Windows.NATIVE_UNICODE_STRINGFORMAT # or connection.stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT For more information, have a look at the data types section and the connection.stringformat documentation: http://www.egenix.com/files/python/mxODBC.html#Datatypes -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 10 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From kshahzadbutt at gmail.com Wed Nov 10 09:25:45 2004 From: kshahzadbutt at gmail.com (Khawaja-Shahzad Butt) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] unicode, sql command, mxODBC In-Reply-To: <20041110123453.49418.qmail@web10805.mail.yahoo.com> References: <20041110123453.49418.qmail@web10805.mail.yahoo.com> Message-ID: Hi, As far my knowledge goes. I guess with mxODBC you can not run SQL involving unicode strings. You have to encode them into utf-8. Here a suggestion: try: var1=var1.encode('utf8'); ; except: var1=var1; and so on store you values which you want to insert into variables, then encode all the variables into utf-8. then try the insert statement. query_str = "INSERT INTO table\ (a,b,c)\ VALUES (?,?,?)" cursor.execute(query_str, (var1,var2, var3,)) Try this and let me know. Hope this helps. On Wed, 10 Nov 2004 04:34:53 -0800 (PST), zhihua ouyang wrote: > Hi everyone, > I need your help. I have tried for a while to make > unicoded sql command work with mxODBC in window > xp(Chinese Version) but failed since some unicode > chinese characters are in it. > > Here is my case: > 1. A Excel file in c:\\test.xls which contains > chinese characters. > 2. I got the data from test.xls using the following > code > > from win32com.client import DispatchEx > xApp = DispatchEx("Excel.Application") > xBook = xApp.Workbooks.Open('c:\\test.xls') > sheet = xBook.Worksheets('sheet1') > aaa = [] > for i in range(10): > aaa.append(sheet.Cell(5,i).Value) > ...... > > and generate sql command dynamically with those > chinese data. The following is an example: > > sqlCommandStr = u"INSERT INTO instruments VALUES > ('0401', 23800.0, > 0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');" > > But mxODBC gives error info: "sql command must be a > string". > > If chinese characters are inserted into the sql > command like > "INSERT INTO instruments VALUES ('0401', 23800.0, > 0.0,'????','156','2000-1-1','????');" > everything is fine. But I don't know how to > generate it in above condition. > > Does mxODBC accept the unicoded sql command? > > Thanks. > > Ouyang > > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users > From maneeshsingh at yahoo.com Thu Nov 11 03:39:20 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode Message-ID: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Hi, I'm trying to connect to a Microsoft SQL Server 2000 database through a Fedora Core 2 machine, using python 2.3. I have tried using the mxODBC package from eGenix. The code is as follows: -------------------------------- #!/usr/bin/python2.3 import mx.ODBC.iODBC db = mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') c = db.cursor() c.execute('select count(*) from tb_mis_team') c.fetchone() c.tables(None,None,None,None) mx.ODBC.print_resultset(c) c.close() db.close() -------------------------------- This is the output that I get: -------------------------------- [root@ps0778 cgi-bin]# python db5.py Traceback (most recent call last): File "db5.py", line 4, in ? import mx.ODBC.iODBC File "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", line 8, in ? from mxODBC import * ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: SQLSetConfigMode [root@ps0778 cgi-bin]# -------------------------------- Could anyone tell me what could be the problem here? I have installed eGenix's mxODBC from source, and if the installation is done through SRC RPM, then the error that we get is ImportError: /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: undefined symbol: PyUnicodeUCS2_AsEncodedString It like I install through this method then one problem, another method then another problem. I nee the above problems solved together. Thanks! Maneesh Singh. __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From mal at egenix.com Thu Nov 11 13:20:41 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111113920.86214.qmail@web14225.mail.yahoo.com> References: <20041111113920.86214.qmail@web14225.mail.yahoo.com> Message-ID: <41935919.5050004@egenix.com> Maneesh Singh wrote: > Hi, > > I'm trying to connect to a Microsoft SQL Server 2000 > database through a Fedora Core 2 machine, using python > 2.3. > > I have tried using the mxODBC package from eGenix. > > The code is as follows: > > -------------------------------- > #!/usr/bin/python2.3 > > import mx.ODBC.iODBC > > db = > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > c = db.cursor() > c.execute('select count(*) from tb_mis_team') > c.fetchone() > > c.tables(None,None,None,None) > > mx.ODBC.print_resultset(c) > c.close() > db.close() > -------------------------------- > > > This is the output that I get: > > -------------------------------- > [root@ps0778 cgi-bin]# python db5.py > Traceback (most recent call last): > File "db5.py", line 4, in ? > import mx.ODBC.iODBC > File > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > line 8, in ? > from mxODBC import * > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: SQLSetConfigMode > [root@ps0778 cgi-bin]# > -------------------------------- > > > Could anyone tell me what could be the problem here? SQLSetConfigMode is not used in mxODBC, so this unresolved symbol mut be coming from iODBC. Try ldd ./mxODBC.so and see whether it acutally picks up the right version of libiodbc (the one you compiled mxODBC against). > I have installed eGenix's mxODBC from source, and if > the installation is done through SRC RPM, then the > error that we get is > > ImportError: > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > undefined symbol: PyUnicodeUCS2_AsEncodedString This is the standard UCS2 vs. UCS4 build problem: Python can be compiled to use UCS2 Unicode (2 bytes per Unicode code point) or UCS4 (4 bytes). Many current Unix distributions choose UCS4 as the default since that's also what the glibc chose as default. You have to build mxODBC using the build version that your Python installation uses. > It like I install through this method then one > problem, another method then another problem. I nee > the above problems solved together. > > > Thanks! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 11 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From maneeshsingh at yahoo.com Thu Nov 11 08:01:27 2004 From: maneeshsingh at yahoo.com (Maneesh Singh) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <41935919.5050004@egenix.com> Message-ID: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Hi, I tried the ldd ./mxODBC.so It does not have a link for libiodbc.so.2 Which it should! The problem with RPM was that the dependency on libiodbc.so.2. This actually existed on the machine and I also gave this library path under the LD_LIBRARY_PATH variable. Still it would say dependency on libiodbc.so.2. Hence I went in for SRC install which would give the "PyUnicodeUCS2_AsEncodedString" error. Then I installed it with rpm --rebuild SRC RPM. I have done so many methods, I can't even remeber which the current method under which it is running. Four hours were spent installing iODBC and mxODBC from sources, RPMs. I have followed all the procedures I could possibly find in README files. Anyways, how do I rectify the ldd ./mxODBC.so not giving libiodbc.so.2. Thanks! Maneesh. --- "M.-A. Lemburg" wrote: > Maneesh Singh wrote: > > Hi, > > > > I'm trying to connect to a Microsoft SQL Server > 2000 > > database through a Fedora Core 2 machine, using > python > > 2.3. > > > > I have tried using the mxODBC package from eGenix. > > > > The code is as follows: > > > > -------------------------------- > > #!/usr/bin/python2.3 > > > > import mx.ODBC.iODBC > > > > db = > > > mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser') > > c = db.cursor() > > c.execute('select count(*) from tb_mis_team') > > c.fetchone() > > > > c.tables(None,None,None,None) > > > > mx.ODBC.print_resultset(c) > > c.close() > > db.close() > > -------------------------------- > > > > > > This is the output that I get: > > > > -------------------------------- > > [root@ps0778 cgi-bin]# python db5.py > > Traceback (most recent call last): > > File "db5.py", line 4, in ? > > import mx.ODBC.iODBC > > File > > > "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py", > > line 8, in ? > > from mxODBC import * > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: SQLSetConfigMode > > [root@ps0778 cgi-bin]# > > -------------------------------- > > > > > > Could anyone tell me what could be the problem > here? > > SQLSetConfigMode is not used in mxODBC, so this > unresolved > symbol mut be coming from iODBC. Try ldd ./mxODBC.so > and see whether it acutally picks up the right > version > of libiodbc (the one you compiled mxODBC against). > > > I have installed eGenix's mxODBC from source, and > if > > the installation is done through SRC RPM, then the > > error that we get is > > > > ImportError: > > > /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so: > > undefined symbol: PyUnicodeUCS2_AsEncodedString > > This is the standard UCS2 vs. UCS4 build problem: > > Python can be compiled to > use UCS2 Unicode (2 bytes per Unicode code point) or > UCS4 > (4 bytes). Many current Unix distributions choose > UCS4 > as the default since that's also what the glibc > chose > as default. > > You have to build mxODBC using the build version > that your > Python installation uses. > > > It like I install through this method then one > > problem, another method then another problem. I > nee > > the above problems solved together. > > > > > > Thanks! > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the > Source (#1, Nov 11 2004) > >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > ________________________________________________________________________ > > ::: Try mxODBC.Zope.DA for > Windows,Linux,Solaris,FreeBSD for free ! :::: > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From khoxsey at earthlink.net Thu Nov 11 08:18:22 2004 From: khoxsey at earthlink.net (Kent Hoxsey) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4EED3FF1-33FD-11D9-A75B-000A95A4EB88@earthlink.net> >> Maneesh Singh wrote: >>> Hi, >>> >>> I'm trying to connect to a Microsoft SQL Server >> 2000 >>> database through a Fedora Core 2 machine, using >> python >>> 2.3. >>> >>> I have tried using the mxODBC package from eGenix. Maneesh, I'm using an older version of RedHat Enterprise, but am able to connect to SQL Server just fine using mxODBC, so you should be able to get things set up just fine. I have a couple of pointers to offer that may help: 1. I'm assuming you're using FreeTDS as your driver. Have you tried connecting to your database using isql to make sure the libraries are installed properly? 2. I see you're using iODBC. Did you choose this for a reason, or just by default? If you have no compelling reason to use iODBC over unixODBC, I would suggest switching to unixODBC. I've used both, and unixODBC seems to be a bit more mature and robust. 3. Once you've got your driver libs (freetds) working properly, and your driver manager (unixODBC) working correctly, then try the sample code for mxODBC. I've found that it's much easier to debug the setup by making sure each of the supporting layers works properly before installing the next layer above. Kent From mal at egenix.com Fri Nov 12 09:42:55 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode In-Reply-To: <20041111160127.22994.qmail@web14226.mail.yahoo.com> References: <20041111160127.22994.qmail@web14226.mail.yahoo.com> Message-ID: <4194778F.9040704@egenix.com> Maneesh Singh wrote: > Hi, > > I tried the ldd ./mxODBC.so > It does not have a link for libiodbc.so.2 > Which it should! The problem with RPM was that the > dependency on libiodbc.so.2. This actually existed on > the machine and I also gave this library path under > the LD_LIBRARY_PATH variable. Still it would say > dependency on libiodbc.so.2. Hence I went in for SRC > install which would give the > "PyUnicodeUCS2_AsEncodedString" error. Then I > installed it with rpm --rebuild SRC RPM. I have done > so many methods, I can't even remeber which the > current method under which it is running. Four hours > were spent installing iODBC and mxODBC from sources, > RPMs. I have followed all the procedures I could > possibly find in README files. > > Anyways, how do I rectify the ldd ./mxODBC.so not > giving libiodbc.so.2. Hard to tell without looking at your setup. I'd suggest you get a support ticket and we login to you machine to sort things out. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 12 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From cfbearden at gmail.com Mon Nov 15 16:11:29 2004 From: cfbearden at gmail.com (Chuck Bearden) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? Message-ID: <433ebc87041115141175025033@mail.gmail.com> I want to create an alternate installation of mx.ODBC to test a new combination of iODBC and FreeTDS. I therefore need to have the mx.ODBC build process ignore the iODBC and FreeTDS installations in /usr/local. I have edited mxCOMMERCIAL.py to point to the test installations: Extension('mx.ODBC.iODBC.mxODBC', ['mx/ODBC/iODBC/mxODBC.c', 'mx/ODBC/iODBC/mxSQLCodes.c' ], include_dirs=['mx/ODBC/iODBC', '/home/cbearden/opt/libiodbc-3.52.1/include'], define_macros=[('iODBC', None)], library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], libraries=['iodbc'] ), After I run 'python setup.py install --home=/home/cbearden/opt1', the mxODBC.so still seems to depend on the installations in /usr/local : $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libiodbcinst.so.2 => /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) libdl.so.2 => /lib/libdl.so.2 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I get the same result when I run ldd against the mxODBC.so in the source tree. Is there some precaution I need to take when building mx.ODBC to force it to use a particular set of libraries and includes in a non-standard location? Thanks, Chuck From gserdaris at optusnet.com.au Wed Nov 17 12:00:17 2004 From: gserdaris at optusnet.com.au (George Serdaris) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] py2exe and mx.DateTime issue Message-ID: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Hi all, I am getting the following error message when trying to build an exe using py2exe: The following modules appear to be missing ['mxDateTime.__version__'] An executable is created, but I'm unable to connect to the Oracle database. Connection to oracle was possible using cx_Oracle. Location to the mxDateTime appears to be found as I get the following appearing in the shell: *** byte compile python files *** creating C:\data\Python\build\bdist.win32\winexe\collect\mx creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc . copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd -> C:\data\Python\dist I have followed instructions on freezing mx.DateTime to the py2exe command line i.e. "-i mx.DateTime" with no luck. I have also tried forcing the path to mx.DateTime into the sys.path to no avail. I have experimented with -p option as well i.e. "-p mx.DateTime", but this produces another error message: The following modules appear to be missing ['mxDateTime.__version__', 'mx.DateTime.now'] Environment/packages used are as follows: OS is WinXP SP2 Python Version is 2.3.4 mx-base v2.0.5 cx_Oracle v4.0.1 wx Python v2.5.2.8 Any assistance on this issue would be greatly appreciated. Cheers, George Serdaris -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20041117/d476a09e/attachment-0139.htm From mal at egenix.com Wed Nov 17 11:02:51 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] py2exe and mx.DateTime issue In-Reply-To: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> References: <200411170100.iAH10Jal030130@mail17.syd.optusnet.com.au> Message-ID: <419B21CB.8000001@egenix.com> George Serdaris wrote: > Hi all, > > > > I am getting the following error message when trying to build an exe using > py2exe: > > The following modules appear to be missing > > ['mxDateTime.__version__'] > This can safely be ignored. > An executable is created, but I'm unable to connect to the Oracle database. > Connection to oracle was possible using cx_Oracle. There are two things to be checked: 1. Can your application import and use mxDateTime (without cx_Oracle) ? I expect this to be the case. 2. Where does cx_Oracle look for the mxDateTime package ? Does it successfully import the package ? To track this one down you have to set the PYTHONVERBOSE environment variable to 2 and then look at the log output. > > > Location to the mxDateTime appears to be found as I get the following > appearing in the shell: > > > > *** byte compile python files *** > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime > > creating > C:\data\Python\build\bdist.win32\winexe\collect\mx\DateTime\mxDateTime > > creating C:\data\Python\build\bdist.win32\winexe\collect\mx\Misc > > . > > copying C:\Python23\lib\site-packages\mx\DateTime\mxDateTime\mxDateTime.pyd > -> C:\data\Python\dist > > > > I have followed instructions on freezing mx.DateTime to the py2exe command > line i.e. "-i mx.DateTime" with no luck. > > > > I have also tried forcing the path to mx.DateTime into the sys.path to no > avail. > > > > I have experimented with -p option as well i.e. "-p mx.DateTime", but this > produces another error message: > > The following modules appear to be missing > > ['mxDateTime.__version__', 'mx.DateTime.now'] > > > > Environment/packages used are as follows: > > OS is WinXP SP2 > > Python Version is 2.3.4 > > mx-base v2.0.5 > > cx_Oracle v4.0.1 > > wx Python v2.5.2.8 > > > > Any assistance on this issue would be greatly appreciated. > > > > Cheers, > > > > George Serdaris > > > > > ------------------------------------------------------------------------ > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From mal at egenix.com Thu Nov 18 17:32:35 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] Changing extension paths in mxCOMMERCIAL.py? In-Reply-To: <433ebc87041115141175025033@mail.gmail.com> References: <433ebc87041115141175025033@mail.gmail.com> Message-ID: <419CCEA3.5010606@egenix.com> Chuck Bearden wrote: > I want to create an alternate installation of mx.ODBC to test a new > combination of iODBC and FreeTDS. I therefore need to have the > mx.ODBC build process ignore the iODBC and FreeTDS installations in > /usr/local. I have edited mxCOMMERCIAL.py to point to the test > installations: > > Extension('mx.ODBC.iODBC.mxODBC', > ['mx/ODBC/iODBC/mxODBC.c', > 'mx/ODBC/iODBC/mxSQLCodes.c' > ], > include_dirs=['mx/ODBC/iODBC', > '/home/cbearden/opt/libiodbc-3.52.1/include'], > define_macros=[('iODBC', None)], > library_dirs=['/home/cbearden/opt/libiodbc-3.52.1/lib'], > libraries=['iodbc'] > ), > > After I run 'python setup.py install --home=/home/cbearden/opt1', the > mxODBC.so still seems to depend on the installations in /usr/local : > > $ ldd opt1/lib/python/mx/ODBC/iODBC/mxODBC.so > libiodbc.so.2 => /usr/local/libiodbc/lib/libiodbc.so.2 (0x4002d000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40069000) > libc.so.6 => /lib/tls/libc.so.6 (0x42000000) > libiodbcinst.so.2 => > /usr/local/libiodbc-3.51.2/lib/libiodbcinst.so.2 (0x40077000) > libdl.so.2 => /lib/libdl.so.2 (0x40081000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > I get the same result when I run ldd against the mxODBC.so in the source tree. The locations where you dynamic linker searches for libiodbc.so depend on your linker configuration, not the settings you used when compiling mxODBC. Try adjusting the ld path either statically in the /etc configuration file or dynamically via the appropriate environment variable for your system. > Is there some precaution I need to take when building mx.ODBC to force > it to use a particular set of libraries and includes in a non-standard > location? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 18 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From keithmoore1 at adelphia.net Thu Nov 18 18:41:51 2004 From: keithmoore1 at adelphia.net (Keith Moore) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] Crash when Database is not running Message-ID: I noticed the I get a fatal Python error, when I attempt to access the database while it is not running. Is there a way using mxODBC to verify the Database server is running before I try to send a query to it? If I know the database is not there, I can generate an error message and close gracefully. Thanks, Keith From mal at egenix.com Fri Nov 19 09:46:23 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] Crash when Database is not running In-Reply-To: References: Message-ID: <419DB2DF.1040608@egenix.com> Keith Moore wrote: > I noticed the I get a fatal Python error, when I attempt to access the > database while it is not running. Is there a way using mxODBC to verify the > Database server is running before I try to send a query to it? If I know > the database is not there, I can generate an error message and close > gracefully. This kind of problem crops up every now and then: some ODBC drivers or their network layers have problems dealing with lost database connections or they simply don't gracefully cleanup the connection objects after the connection has gone down. As a result calling standard ODBC API functions results in fatal errors - something that we can only work-around from mxODBC, but not entirely prevent. Could you describe the error in more detail ? What kind of output are you seeing ? Can you send us a stack trace ? Which database and ODBC driver are you using ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 19 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From simon.brunning at gmail.com Thu Nov 25 10:08:22 2004 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] Python 2.4 Message-ID: <8c7f10c604112502086ac98eae@mail.gmail.com> Will Python 2.4 builds of the mx extensions for Windows be made available during the release candidate stage, or will you hold fire until final release? -- Cheers, Simon B, simon@brunningonline.net, http://www.brunningonline.net/simon/blog/ From mal at egenix.com Thu Nov 25 12:02:17 2004 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Mar 31 16:33:51 2006 Subject: [egenix-users] Python 2.4 In-Reply-To: <8c7f10c604112502086ac98eae@mail.gmail.com> References: <8c7f10c604112502086ac98eae@mail.gmail.com> Message-ID: <41A5BBB9.2050500@egenix.com> Simon Brunning wrote: > Will Python 2.4 builds of the mx extensions for Windows be made > available during the release candidate stage, or will you hold fire > until final release? As always: we will wait until the final version is released and then follow up with builds for the new version within one or two weeks. However, there may be a slight delay for the 2.4 Windows version. The reason is that Python will switch to VC7 using the .NET framework, so we'll have to create builds using VC7 for Python 2.4. If you don't want to wait until then, you can always create builds yourself. All you need is the VC7 compiler which is part of the free .NET SDK. Note: We won't provide Win64 builds. We will however start to provide SuSE 9.2 RPMs for x64_64 (aka AMD64). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 25 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::